package org.poem.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.poem.entity.TTaskType;
import org.poem.mapper.TTaskTypeMapper;
import org.poem.service.ITTaskTypeService;
import org.poem.task.TaskTypeVO;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;


/**
 * <p>
 * 主题 服务实现类
 * </p>
 *
 * @author vinshine
 * @since 2019-10-24
 */
@Service
public class TTaskTypeServiceImpl extends ServiceImpl<TTaskTypeMapper, TTaskType> implements ITTaskTypeService {


    /**
     * 添加任务
     * @return
     */
    @Override
    public List<TaskTypeVO> searchTaskType() {
        List<TTaskType> tTaskTypes = this.list();
        return tTaskTypes.parallelStream().map(
                o->{
                    TaskTypeVO vo = new TaskTypeVO();
                    vo.setName(o.getName());
                    vo.setDataSourceType(o.getDataSourceType());
                    vo.setId(o.getId());
                    vo.setContent(o.getContent());
                    return vo;
                }
        ).collect(Collectors.toList());
    }
}
